package com.yellow.courierservice.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yellow.courierservice.entity.CourierProfile;
import com.yellow.courierservice.mapper.CourierProfileMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class CourierProfileServiceImpl extends ServiceImpl<CourierProfileMapper, CourierProfile> implements CourierProfileService {

    @Resource
    private CourierProfileMapper courierProfileMapper;
    @Override
    public CourierProfile getCourierProfileByCourierName(String name) {
        LambdaQueryWrapper<CourierProfile> wrapper = new LambdaQueryWrapper<CourierProfile>().eq(CourierProfile::getName, name);
        return courierProfileMapper.selectOne(wrapper);
    }

    @Override
    public Integer getCourierIdByCourierName(String name) {
        LambdaQueryWrapper<CourierProfile> wrapper = new LambdaQueryWrapper<CourierProfile>().eq(CourierProfile::getName, name);
        return courierProfileMapper.selectOne(wrapper).getCourierId();
    }
}
